package com.pureut.scheduling.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pureut.scheduling.domain.BackWeight;
import com.pureut.scheduling.domain.SchedulingPlan;
import com.pureut.scheduling.domain.SchedulingPlan2;
import com.pureut.scheduling.domain.dto.SchedulingOrderDto;
import com.pureut.scheduling.domain.dto.SchedulingPlanDto;
import com.pureut.scheduling.domain.vo.MaterialMqVo;
import com.pureut.scheduling.domain.vo.SchedulingPlanVo;
import com.pureut.scheduling.domain.vo.UpdateSaleVo;
import com.pureut.system.api.vo.SalesOrderDetailVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description 计划信息
 * @Param
 * @Date
 * @Author hl
 **/
public interface SchedulingPlanMapper  extends BaseMapper<SchedulingPlan> {

    /**
     * 查询计划信息
     */
    List<SchedulingPlanDto> selectPlanList(SchedulingPlanVo schedulingPlanVo);

    /**
     * 计划退回
     */
    int updatePlanBackEdit(SchedulingPlan schedulingPlan);

    /**
     * 计划确认
     */
    int updateSchedulingPlan(SchedulingPlanVo schedulingPlanVo);

    /**
     * 计划终止
     */
    int updatePlanTheEndEdit(SchedulingPlan schedulingPlan);

    /**
     * 计划新增接受
     */
    int insertSchedulingOrderPlan(List<SchedulingPlanVo> planList);

    /**
     * 查询单个计划排程
     */
    SchedulingOrderDto selectPlanOnById(long planId);

    /**
     * 根据物料编码查询克重
     */
    double selectGramWeightOnById(String code);

    /**
     * 修改该计划中的物料信息
     */
    void updatePlanMaterialFinished(MaterialMqVo mq);

    /**
     * 回传重量
     */
    int updatePlanBack(BackWeight backWeight);

    /**
     * 扣减重量
     */
    int updatePlanBackDelete(BackWeight backWeight);

    void updateStatus(String code);

    String getPlanData(String planCode);

    /**
     * 根据计划单号获取单据详情
     *
     * @param planCode
     * @return
     */
    SchedulingPlanDto getPlanView(String planCode);

    /**
     * 修改拍成计划状态为已完成
     */
    boolean updatePlanStatus(long planId);

    /**
     * 查询排程计划信息(状态为“待排产、生产中”的单据)
     *
     * @return
     */
    List<SchedulingPlanDto> getListByStatus();

    /**
     * 删除预排程单
     *
     * @param planCode
     * @return
     */
    boolean removeProductionScheling(String planCode);

    /**
     * 通过计划单号查出排程信息
     *
     * @param planCode
     * @return
     */
    SchedulingPlanDto getPlanInfo(String planCode);

    /**
     * 修改排程单状态
     *
     * @param updateSaleVo
     * @return
     */
    boolean updatePlanStatusUnit(UpdateSaleVo updateSaleVo);

    /**
     * 获取排程单数据
     */
    List<SchedulingPlanDto> getSchedulingPlan(UpdateSaleVo updateSaleVo);

    /**
     * 修改排程数据（销售订单明细修改回传数据）
     */
    boolean updateSchedulingPlanData(@Param("salesData") SalesOrderDetailVo salesData, @Param("updateSaleVo") UpdateSaleVo updateSaleVo);

}
